//
//  SecondViewController.m
//  UI13_XIB
//
//  Created by dllo on 15/11/25.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "SecondViewController.h"
#import "CustomTableViewCell.h"

@interface SecondViewController ()<UITableViewDataSource, UITableViewDelegate>
@property (retain, nonatomic) IBOutlet UILabel *label1;
@property (retain, nonatomic) IBOutlet UITextField *textF1;

@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    UITableView *tableV = [[UITableView alloc] initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, 500) style:UITableViewStylePlain];
    tableV.delegate = self;
    tableV.dataSource = self;
    [self.view addSubview:tableV];
    [tableV release];
    
//    [tableV registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    
    UINib *nib = [UINib nibWithNibName:@"CustomTableViewCell" bundle:[NSBundle mainBundle]];
    [tableV registerNib:nib forCellReuseIdentifier:@"cell"];
    
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    return cell;
}

- (IBAction)buttonAction:(UIButton *)sender {
    
    self.label1.text = self.textF1.text;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (void)dealloc {
    [_label1 release];
    [_textF1 release];
    [super dealloc];
}
@end
